package cn.wolfcode.mq.linstener;

import cn.wolfcode.mq.MQConstant;
import cn.wolfcode.service.IOrderInfoService;
import cn.wolfcode.service.ISeckillProductService;
import cn.wolfcode.web.controller.OrderInfoController;

import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

/**
 * @Author: 普发忠
 * @Date: 2021/11/11/14:17
 */
@Component
@RocketMQMessageListener(
        topic = MQConstant.CANCEL_SECKILL_OVER_SIGE_TOPIC,
        consumerGroup = "cancel_seckill_over_sige_topic-consumer",
        messageModel= MessageModel.BROADCASTING
)
public class CancelSeckillOverSigeListener implements RocketMQListener<Long> {
    @Autowired
    private IOrderInfoService orderInfoService;
    @Autowired
    private RocketMQTemplate rocketMQTemplate;
    @Autowired
    private ISeckillProductService seckillProductService;
    @Autowired
    private StringRedisTemplate redisTemplate;
    
    @Override
    public void onMessage(Long seckillId) {
        OrderInfoController.LOCAL_FLAG_MAP.put(seckillId,true);
    }
}
